/*
 * ServiceData.java
 * 
 * This file is part of Netuno.
 * 
 * CajuScript is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3, or (at your option) 
 * any later version.
 * 
 * CajuScript is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with CajuScript.  If not, see <http://www.gnu.org/licenses/>.
*/

package org.netuno;

import java.net.Socket;
import java.io.IOException;
import org.netuno.psamata.io.InputStream;
import org.netuno.psamata.io.OutputStream;

/**
 * Service Data.
 * @author eduveks
 */
public class ServiceData {
    /**
     * Thread ID.
     */
    private int threadID = -1;
    /**
     * Client Socket Input Stream.
     */
    private InputStream in;
    /**
     * Client Socket Output Stream.
     */
    private OutputStream out;
    /**
     * Client Socket.
     */
    private Socket clientSocket;
    /**
     * Service Data.
     * @param socket Client Socket
     * @param thread Thread ID
     * @throws IOException Client Socket Input Stream
     * @throws IOException Client Socket Output Stream
     */
    public ServiceData(final Socket socket, final int thread)
    throws IOException {
        this.clientSocket = socket;
        this.threadID = thread;
        in = new InputStream(socket.getInputStream());
        out = new OutputStream(socket.getOutputStream());
    }
    /**
     * Get Client Socket Input Stream.
     * @return Client Socket Input Stream
     * @throws IOException Client Socket Input Stream
     */
    public final InputStream getInputStream() throws IOException {
        return in;
    }
    /**
     * Get Client Socket Output Stream.
     * @return Client Socket Output Stream
     * @throws IOException Client Socket Output Stream
     */
    public final OutputStream getOutputStream() throws IOException {
        return out;
    }
    /**
     * Get Thread ID.
     * @return Thread ID
     */
    public final int getThreadID() {
        return threadID;
    }
    /**
     * Get Client Socket.
     * @return Client Socket
     */
    public final Socket getClientSocket() {
        return clientSocket;
    }
}
